import './assets/main.css'
import 'element-plus/dist/index.css'
import * as echarts from 'echarts/core';
import App from './App.vue'
import router from './router'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { CandlestickChart, LineChart, BarChart } from 'echarts/charts';
import { TitleComponent, TooltipComponent, GridComponent, LegendComponent, DataZoomComponent } from 'echarts/components';
import { CanvasRenderer } from 'echarts/renderers';
import { FullScreen, CloseBold } from '@element-plus/icons-vue'
const app = createApp(App)
// 注册所需的组件和渲染器
echarts.use([CandlestickChart, TitleComponent, TooltipComponent, GridComponent,
  CanvasRenderer, LineChart, LegendComponent, DataZoomComponent, BarChart]);

app.use(createPinia())
app.use(router)
app.provide('echarts', echarts);
app.component('FullScreen', FullScreen)
app.component('CloseBold', CloseBold)
// 只在页面首次加载时判断
if (
  window.location.pathname !== '/' &&
  performance.getEntriesByType &&
  performance.getEntriesByType('navigation')[0]?.type === 'reload'
) {
  router.replace('/')
}
app.mount('#app')
